package annotation;

import java.lang.annotation.*;

/**
 * Created by Administrator on 2017/10/24 024.
 */
public class Demo3
{
    public static void main(String[] args) throws Exception
    {
        Class<Tset> c = Tset.class;
        Tag1[] ts = c.getAnnotationsByType(Tag1.class);
        for (Tag1 t : ts)
        {
            System.out.println("-->" + t.name() + "-->" + t.age());
        }
    }



    @Repeatable(Tags.class)
    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.TYPE)
    public @interface Tag1
    {
        String name() default "ytf";
        int age() default 25;
    }

    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.TYPE)
    public @interface Tags
    {
        Tag1[] value();
    }
}

@Demo3.Tag1(name = "yutf")
@Demo3.Tag1(age = 26)
class Tset
{

}
